package com.lijiajia.cloud.common.security.publiser;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.AuthenticationEventPublisher;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;

/**
 * 认证事件日志 发布者
 *
 * @author lijiajia
 * @since 2019-04-03
 */
@Slf4j
public class LogAuthenticationEventPublisher implements AuthenticationEventPublisher {
    @Override
    public void publishAuthenticationSuccess(Authentication authentication) {
        log.debug("cloud auth resource success {}", authentication);
    }

    @Override
    public void publishAuthenticationFailure(AuthenticationException exception, Authentication authentication) {
        log.debug("cloud auth resource fail {}, exception {}", authentication, exception);
    }
}
